<?php
session_start();
require_once 'Login/databaseconnection.php';
if(!loggedin())
{
	require_once ("index.php");
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
<head>
<link rel="icon" href="sms.bmp" type="image/x-icon" />
<title>Quick Search of SMS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet" href="style_qs.css" type="text/css" />
<script type="text/javascript">
function getdetails_popup(str,sch)
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("get_popup").innerHTML=xmlhttp.responseText;
    }
  }
  if(str=="Tra_Teachers"||str=="Tra_Male_Teachers"||str=="Tra_Female_Teachers")
  {
var appo_sub=document.forms["traform"]["Tra_name"].value; 
str=str+","+sch+","+appo_sub;
  }
  else if(str=="T_Labs"||str=="Lan_Ava_Labs"||str=="Wan_Ava_Labs"||str=="Number_Of_Labs"||str=="Number_Of_Equipments")
  {
var Lab_Type=document.forms["l_t"]["Lab_Type"].value; 
str=str+","+sch+","+Lab_Type;
  }
  else if(str=="No_Appo_Teachers")
  {
var appo_sub=document.forms["a_s"]["Appo_Sub"].value; 
str=str+","+sch+","+appo_sub;
  }
  else
  {
  str=str+","+sch;
  }
xmlhttp.open("GET","QuickSearch/get_details_in_popup.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function Designation(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("Designation").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+atype;
xmlhttp.open("GET","QuickSearch/designation.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function getSts_Det(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("staff").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+atype;
xmlhttp.open("GET","QuickSearch/getstaffdetails.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function lab_type(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("lab_details").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+atype;
xmlhttp.open("GET","QuickSearch/getlabdetails.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function getexamsubject(str,sch)
{
var xmlhttp; 

if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("subject").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch;
xmlhttp.open("GET","QuickSearch/getexamsubject.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function getexamyear(str,sch)
{
var xmlhttp; 
var exa=document.forms["ExaName"]["Exam_Name"].value;  
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("exa_year").innerHTML=xmlhttp.responseText;
    }
  }
  str=exa+","+str+","+sch;
xmlhttp.open("GET","QuickSearch/getexamyear.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function get_exam_details(str,sch)
{
var xmlhttp; 
var exa=document.forms["ExaName"]["Exam_Name"].value; 
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("Exam").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+exa;
xmlhttp.open("GET","QuickSearch/getexamdetails.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function get_stu_details(str,sch)
{
var xmlhttp; 
var gra=document.forms["Stu_Grade"]["Grade"].value; 
var year=document.forms["Stu_Year"]["Student_Year"].value; 
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("stu_year_details").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+year+","+gra;
xmlhttp.open("GET","QuickSearch/getstuyear_details.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function stu_getyear(str,sch)
{
var xmlhttp;   
var gra=document.forms["Stu_Grade"]["Grade"].value;  

if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("stu_year").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+gra;
xmlhttp.open("GET","QuickSearch/getstuyear.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function grade(str,sch)
{
var xmlhttp;    

if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("Stu_Details").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch;
xmlhttp.open("GET","QuickSearch/getstu_details.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function getdetails(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp; 
var pro=document.forms["pro_name"]["Programme_Name"].value;   

if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("prodetails").innerHTML=xmlhttp.responseText;
    }
  }
  str=pro+","+str+","+sch+","+atype;
xmlhttp.open("GET","QuickSearch/getprodetails.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function getyear(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("year").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+atype;
xmlhttp.open("GET","QuickSearch/getpro_year.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function duration(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var func=document.forms["traform"]["func"].value;
var traname=document.forms["traform"]["Tra_name"].value;
var xmlhttp;    

if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("byduration").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+func+","+traname+","+atype;
xmlhttp.open("GET","QuickSearch/getbyduration.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function showAppTea(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("Appo_Tea").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+atype;
xmlhttp.open("GET","QuickSearch/AppoTea.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function getDurati(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp;
var traname=document.forms["traform"]["Tra_name"].value;    

if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("Durati").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+traname+","+atype;
xmlhttp.open("GET","QuickSearch/getDurati.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function TraDetails(str,sch)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var xmlhttp; 
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("TraDet").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+sch+","+atype;
xmlhttp.open("GET","QuickSearch/TraDet.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function cleartbox()
{
	document.getElementById("List").innerHTML="";
	document.getElementById("school").value="";	
	document.getElementById("get_popup").innerHTML="";
}
</script>
<script type="text/javascript">
function clearpopbox()
{
	document.getElementById("List").innerHTML="";
	document.getElementById("get_popup").innerHTML="";
}
</script>
<script type="text/javascript">
function getHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function showHint(str)
{
var xmlhttp;
if (str=="")
  {
  document.getElementById("List").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("List").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","quicksearch_sch_names.php?q="+str,true);
xmlhttp.send();
}
function fill(val)
{
var atype=document.forms["form1"]["Acc_Type"].value; 
var attribute=document.forms["form1"]["attribute"].value;
document.form1.school.value=val;
document.getElementById("List").innerHTML="";
var xmlhttp;    
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("quick_search").innerHTML=xmlhttp.responseText;
    }
  }  
  val=val+","+attribute+","+atype;
  xmlhttp.open("GET","qui_sea_div.php?q="+val,true);
xmlhttp.send();
}
</script>		
</head>
<body id="top">
<div class="wrapper col1">
  <div id="headerqs">
    <div id="logoqs">
      <h1>Schools Management System</h1>
        </div>
    <div id="search">
    <?php
	$Access_Type=$_GET["a"];
	$q=$_GET["q"];
$Id=$Access_Type.",".$q;
	if($q!="")
{
$param=explode(",",$q);
$cou=count($param);
$attribute=$param[$cou-1];
$value=$param[0];
$get_sch=mysql_query("SELECT * FROM school WHERE ".$attribute."='".$value."'");
if($get_sch)
{
if($rows=mysql_fetch_array($get_sch))
{
$Name=$rows['Name'];
$Address=$rows['Address'];
$sea_text=$Name.",".$Address;
}
}
}
	?>
      <form action="#" method="post" name="form1">
      <label><b>School's Name/School Id/Census Number</b></label>
        <fieldset>
          <legend>School Search</legend>
          <?php
          if($sea_text!="")
{
if($Access_Type=="Administrator")
{
 echo "<input size='45' type='text' name='school' id='school' value='$sea_text' onKeyUp='showHint(this.value)' onClick='cleartbox()'>";
 }
 else
 {
  echo "<input size='45' type='text' name='school' id='school' value='$sea_text' readonly='readonly' onmouseover='clearpopbox()'/>";
 }
}
else
{
            ?>
            <input size="45" type="text" name="school" id="school" value="Search the school&hellip;" onKeyUp="showHint(this.value)" onClick="cleartbox()"/>
             <?php
}
echo "<input type='hidden' name='Acc_Type' value='$Access_Type'/>";
            ?>
            </fieldset>
     <div class="suggestionListadv" id="List"></div></form>
    </div>
     <div class="clear"></div>
  </div>
</div>
<div id="quick_search">
<?php
if($q!="")
{
include_once ("Login/databaseconnection.php");
$param=explode(",",$q);
$cou=count($param);
$attribute=$param[$cou-1];
if($attribute=="Name")
{
$valuename=$param[0];
for($i=1;$i<$cou-1;$i++)
{
if(empty($valueaddr))
{
$valueaddr=$param[$i];
}
else
{
$valueaddr=$valueaddr.",".$param[$i];
}
}
$get_sch=mysql_query("SELECT * FROM school WHERE ".$attribute."='".$valuename."'");
}
else
{
 $value=$param[0];
$get_sch=mysql_query("SELECT * FROM school WHERE ".$attribute."='".$value."'");
}

if($get_sch)
{
if($rows=mysql_fetch_array($get_sch))
{
$Name=$rows['Name'];
$School_Id=$rows['School_Id'];
$Census_Number=$rows['Census_Number'];
$Principal_Name=$rows['Principal_Name'];
$Address=$rows['Address'];
$Province=$rows['Province'];
$District=$rows['District'];
$Division=$rows['Division'];
$Zone=$rows['Zone'];
$Medium=$rows['Medium'];
$Type=$rows['Type'];
$Status=$rows['Status'];
$Female_Students=$rows['Female_Students'];
$Grade_Range=$rows['Grade_Range'];
$Male_Students=$rows['Male_Students'];
$Tp_Number=$rows['Tp_Number'];
$E_Mail=$rows['E_Mail'];
$Fax_Number=$rows['Fax_Number'];
$Account_Number=$rows['Account_Number'];
$Web_Address=$rows['Web_Address'];
$sp=$rows['Special_Projects'];
$tot_labs=mysql_query("SELECT COUNT(Lab_Id) AS tot_labs FROM lab WHERE School_Id='$School_Id'");
if($rowtl=mysql_fetch_array($tot_labs))
{
$Tot_Labs=$rowtl['tot_labs'];
}
$tot_tea=mysql_query("SELECT COUNT(T_NIC_Number) AS tot_teachers FROM teacher WHERE School_Id='$School_Id'");
if($tot_tea)
{
if($rowtea=mysql_fetch_array($tot_tea))
{
$Tot_Teachers=$rowtea['tot_teachers'];
}
}
}
}
$get_last_lab=mysql_query("SELECT MAX(Lab_Id) AS Max_Id FROM lab WHERE School_Id='$School_Id'");
if($get_last_lab)
{
if($rowlast_lab=mysql_fetch_array($get_last_lab))
{
$Last_lab=$rowlast_lab['Max_Id'];
$get_lab=mysql_query("SELECT * FROM lab WHERE School_Id='$School_Id' AND Lab_Id='$Last_lab'");
if($get_lab)
{
if($rowlab=mysql_fetch_array($get_lab))
{
$Last_Comm_Date=$rowlab['Date_of_commencement'];
}
}
}
}
$get_tea_in_cha=mysql_query("SELECT * FROM user WHERE Access_Type='Teacher in Charge'");
while($in_cha=mysql_fetch_array($get_tea_in_cha))
{
$In_Charge=$in_cha['NIC_Number'];
$get_tea_sch=mysql_query("SELECT * FROM teacher WHERE T_NIC_Number='$In_Charge'");
if($in_cha_sch=mysql_fetch_array($get_tea_sch))
{
$Sch_Id=$in_cha_sch['School_Id'];
if($Sch_Id==$School_Id)
{
$In_Charge_F_N=$in_cha_sch['First_Name'];
$In_Charge_L_N=$in_cha_sch['Last_Name'];
}
}
}

$get_gra_tea=mysql_query("SELECT COUNT(T_NIC_Number) AS No_Gra FROM teacher WHERE Academic_Qualifications LIKE '%deg_%' AND School_Id='$School_Id'");
if($get_gra_tea)
{
if($row_gra=mysql_fetch_array($get_gra_tea))
{
$Graduate_Teachers=$row_gra['No_Gra'];
}
}

$all_tea=mysql_query("SELECT * FROM teacher WHERE School_Id='$School_Id'");
if($all_tea)
{
while($rowalltea=mysql_fetch_array($all_tea))
{
if(empty($All_Teachers))
{
$All_Teachers='"'.$rowalltea['T_NIC_Number'].'"';
}
else
{
$All_Teachers=$All_Teachers.',"'.$rowalltea['T_NIC_Number'].'"';
}
}
}
if($All_Teachers!="")
{
$get_res_per=mysql_query("SELECT COUNT(DISTINCT(T_NIC_Number)) AS No_Res_Per FROM resource_team WHERE T_NIC_Number in($All_Teachers)");
if($get_res_per)
{
if($row_res_per=mysql_fetch_array($get_res_per))
{
$Res_Persons=$row_res_per['No_Res_Per'];
}
}
}
$tot_f_tea=mysql_query("SELECT COUNT(T_NIC_Number) AS tot_f_teachers FROM teacher WHERE (Gender='Female' OR Gender='female') AND School_Id='$School_Id'");
if($tot_f_tea)
{
if($row_fe_tea=mysql_fetch_array($tot_f_tea))
{
$Female_Teachers=$row_fe_tea['tot_f_teachers'];
}
}
$tot_m_tea=mysql_query("SELECT COUNT(T_NIC_Number) AS tot_f_teachers FROM teacher WHERE (Gender='Male' OR Gender='male') AND School_Id='$School_Id'");
if($tot_m_tea)
{
if($row_ma_tea=mysql_fetch_array($tot_m_tea))
{
$Male_Teachers=$row_ma_tea['tot_f_teachers'];
}
}
echo '<div class="wrapper col2">
  <div id="intro">   
    <div class="fl_right">';
     echo "<h1>School's details&hellip;</h1><ul>";     
       echo '<li> 
        <table height="141">
        <tr>
        <td width="120">        
         <label>School Name:</label>
         </td>
         <td width="172">';
         echo "<input type='text' value='$Name' size='30' name='Name' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>School Id:</label>
         </td>
         <td>';
        echo "<input type='text' value='$School_Id' name='School_Id' readonly='readonly' onmouseover='clearpopbox()'/>";
        echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Census Number:</label>
         </td>
         <td>';
        echo "<input type='text' value='$Census_Number' name='Census_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>School Address:</label>
         </td>
         <td>';
		 echo "<textarea name='Address' readonly='readonly' onmouseover='clearpopbox()'>".$Address."</textarea>";
     echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Principal Name:</label>
         </td>
         <td>';
        echo "<input type='text' value='$Principal_Name' name='Principal_Name' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         </table>
        </li>
        <li>
               <table height="141">
        <tr>
        <td width="120">        
         <label>Province:</label>
         </td>
         <td width="170">';
        echo "<input type='text' value='$Province' name='Province' readonly='readonly' onmouseover='clearpopbox()'/>";
echo ' </td>
         </tr>
          <tr>
        <td>        
         <label>District:</label>
         </td>
         <td>';
         echo "<input type='text' value='$District' name='District' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Zone:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Zone' name='Zone' readonly='readonly' onmouseover='clearpopbox()'/>";
echo ' </td>
         </tr>
          <tr>
        <td>        
         <label>Division</label>
         <label>:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Division' name='Division' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>School Status:</label>
         </td>
         <td>';
        echo "<input type='text' value='$Status' name='Status' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
		 <tr>
        <td width="189">        
         <label>School Type:</label>
         </td>
         <td width="111">';
         echo "<input type='text' value='$Type' name='Type' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         </table>
        </li>
        <li>
          <table height="141">        
          <tr>
        <td>        
         <label>Medium:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Medium' name='Medium' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Grade Range:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Grade_Range' name='Grade_Range' readonly='readonly' onmouseover='clearpopbox()'/>";
echo ' </td>
         </tr>
          <tr>
        <td>        
         <label>Number of Male Students:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Male_Students' name='Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo ' </td>
         </tr>
          <tr>
        <td>        
         <label>Number of Female Students:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Female_Students' name='Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
		 <tr>
        <td>        
         <label>Total Number of Teachers:</label>
         </td>
         <td>';
       echo "<input type='text' value='$Tot_Teachers' name='Tot_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
		  <tr>
        <td>        
         <label>Total Number of Labs:</label>
         </td>
         <td>';
        echo "<input type='text' value='$Tot_Labs' name='Tot_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         </table>
        </li>
        <li class="last">
          <table height="141">
        <tr>
        <td width="119">        
         <label>Telephone Number:</label>
         </td>
         <td width="170">';
         echo "<input type='text' value='$Tp_Number' name='Tp_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Fax Number:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Fax_Number' name='Fax_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Email Address:</label>
         </td>
         <td>';
         echo "<input type='text' value='$E_Mail' name='E_Mail' size='30' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Web Address:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Web_Address' name='Web_Address' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <td>        
         <label>Account Number:</label>
         </td>
         <td>';
         echo "<input type='text' value='$Account_Number' name='Account_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
           <tr>
        <td>        
         <label>Special Projects:</label>
         </td>
         <td>';
         echo "<textarea name='Special_Projects' readonly='readonly' onmouseover='clearpopbox()'>".$sp."</textarea>";
echo '</td>
         </tr>
         </table>
        </li>
      </ul> 
    </div>
    </div>
 <div class="clear"></div>
  </div>
<div class="wrapper col3">
  <div id="container">
    <div id="latest">
      <ul>
        <li class="first">
          <h6 align="center">Staff details</h6>';
		  $In_Charge_Name=$In_Charge_F_N." ".$In_Charge_L_N;
		  if($In_Charge_Name==" ")
		  {
		  $In_Charge_Name="No body";
		  }
echo "<label><b>In charge's name:</b></label>";
if($In_Charge_Name!="No body")
{
echo "<input type='text' size='40' name='In_Charge_Name' value='$In_Charge_Name' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' size='40' name='In_Charge_Name' value='$In_Charge_Name' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '<br/>
         <br/>';
		echo "<select name='Staff_Type' id='$School_Id' onChange='getSts_Det(this.value,this.id)' onmouseover='clearpopbox()'>";
		echo '<option value="Academic staff">Academic staff</option><option value="Non academic staff">Non academic staff</option></select>
        <br/>';
    echo '<div id="staff">';
	if($Male_Teachers==""&&$Female_Teachers=="")
	{
	echo '<font color="red">*There is no staff details for this school</font><br/>';
	}
	echo '<table height="175" class="imgholder"> 
      <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
      <tr>
        <th>        
         <label>Number of male teachers:</label>
         </th>
         <td>';
		  if($Male_Teachers=="")
		 {
		 $Male_Teachers="0";
		 }
if($Male_Teachers!="0")
{
echo "<input type='text' name='Male_Teachers' value='$Male_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Male_Teachers' value='$Male_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>   
       <tr>
        <th>        
         <label>Number of female teachers:</label>
         </th>
         <td>';
		 if($Female_Teachers=="")
		 {
		 $Female_Teachers="0";
		 }
if($Female_Teachers!="0")
{
echo "<input type='text' name='Female_Teachers' value='$Female_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Female_Teachers' value='$Female_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>         
         <tr>
        <th>        
         <label>Number of resource persons:</label>
         </th>
         <td>';
		 if($Res_Persons=="")
		 {
		 $Res_Persons="0";
		 }
if($Res_Persons!="0")
{
echo "<input type='text' name='Res_Persons' value='$Res_Persons' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Res_Persons' value='$Res_Persons' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Number of graduate teachers:</label>
         </th>
         <td>';
		 if($Graduate_Teachers=="")
		 {
		 $Graduate_Teachers="0";
		 }
	if($Graduate_Teachers!="0")
{
echo "<input type='text' name='Graduate_Teachers' value='$Graduate_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Graduate_Teachers' value='$Graduate_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>
         <tr>
        <th>        
         <form name="a_s"><label>Number of </label>';
		 echo "<select name='Appo_Sub' id='$School_Id' onChange='showAppTea(this.value,this.id)' onmouseover='clearpopbox()'>";
        	$app_s=mysql_query("SELECT DISTINCT(Appointed_Subject) FROM teacher WHERE  School_Id='$School_Id'");
 while($rowapp_s=mysql_fetch_array($app_s))
  {
  if(empty($sub))
  {
  $sub=$rowapp_s['Appointed_Subject'];
  }
	 $Appointed_Subject=$rowapp_s['Appointed_Subject'];
	echo '<option value="'.$Appointed_Subject.'">'.$Appointed_Subject.'</option>';
  }
echo '</select><label> Teachers:</label>
         </form></th>
         <td>';
		 $tot_tea=mysql_query("SELECT COUNT(T_NIC_Number) AS tot_teachers FROM teacher WHERE Appointed_Subject='$sub' AND School_Id='$School_Id'");
if($tot_tea)
{
if($row_tea=mysql_fetch_array($tot_tea))
{
$App_Teachers=$row_tea['tot_teachers'];
}
}
echo "<div id='Appo_Tea'>";
if($App_Teachers!="0")
{
echo "<input type='text' name='No_Appo_Teachers' value='$App_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='No_Appo_Teachers' value='$App_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo "</div>";
echo '</td></tr></table></div>';
echo '<br/><h6 align="center">';
echo "Trained staffs' details</h6>";
$tra_checking=mysql_query("SELECT * FROM training_details WHERE Teacher_NIC in($All_Teachers)");
if($tra_checking)
{
if(mysql_num_rows($tra_checking)==0)
{
echo '<font color="red">*There is no trained teacher for this school</font><br/><br/>';
}
}
echo "<form name='traform'><label><b>Training name:</b></label><select name='Tra_name' id='$School_Id' onChange='TraDetails(this.value,this.id)' onmouseover='clearpopbox()'>";

	  $tra_nam=mysql_query("SELECT * FROM training");
 while($rowtra_nam=mysql_fetch_array($tra_nam))
  { 
	 $Training_Name=$rowtra_nam['Training_Name'];
	 $Training_Id=$rowtra_nam['Training_Id'];
	  $tra_check=mysql_query("SELECT * FROM training_details WHERE Training_Id='$Training_Id' AND Teacher_NIC in($All_Teachers)");
	   if($tra_check)
	   {
	    if(mysql_num_rows($tra_check)>0)
	   {
	      if(empty($tra_exist))
  {
  $tra_exist='Yes';
  }
   if(empty($tra))
  {
  $tra=$rowtra_nam['Training_Name'];
  }
	echo '<option value="'.$Training_Name.'">'.$Training_Name.'</option>';
	}
	}
  }
 if($tra_exist!='Yes')
  {
  echo '<option value="No result">No result</option>';
  }  
  echo '</select><br/><br/><div id="TraDet">';
  $tra_id=mysql_query("SELECT * FROM training WHERE Training_Name='$tra'");
if($row=mysql_fetch_array($tra_id))
{
$train_id=$row['Training_Id'];
}
$tot_tea=mysql_query("SELECT COUNT(DISTINCT(Teacher_NIC)) AS tot_teachers FROM training_details WHERE Training_Id='$train_id' AND Teacher_NIC in($All_Teachers)");
if($tot_tea)
{
if($row_tea=mysql_fetch_array($tot_tea))
{
$Tra_Teachers=$row_tea['tot_teachers'];
}
}
if($Tra_Teachers=="")
{
$Tra_Teachers="0";
}
$tot_res_per=mysql_query("SELECT COUNT(DISTINCT(T_NIC_Number)) AS res_per FROM resource_team WHERE Training_Id='$train_id' AND T_NIC_Number in($All_Teachers)");
if($tot_res_per)
{
if($row_res_per=mysql_fetch_array($tot_res_per))
{
$Res_per=$row_res_per['res_per'];
}
}
if($Res_per=="")
{
$Res_per="0";
}
echo "<label><b>Total number of trained teachers:</b></label>";
if($Tra_Teachers!="0")
{
echo "<input type='text' name='Tra_Teachers' value='$Tra_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' value='$Tra_Teachers' name='Tra_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '<br/><br/><label><b>Total number of resource persons:</b></label>';
if($Res_per!="0")
{
echo "<input type='text' name='Resource_Persons' value='$Res_per' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Resource_Persons' value='$Res_per' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '<br/><br/><label><b>Duration</b></label>';
        echo "<select name='func' id='$School_Id' onChange='getDurati(this.value,this.id)' onmouseover='clearpopbox()'>";
        echo '<option value="=">Equal to</option><option value=">">Greater than</option><option value=">=">Greater than or equal to</option><option value="<">Less than</option><option value="<=">Less than or equal to</option>';
        echo '</select>
          <div id="Durati">';
		 echo "<select name='Duration' id='$School_Id' onChange='duration(this.value,this.id)' onmouseover='clearpopbox()'>";
		 $nothing="";
$alldura=mysql_query("SELECT * FROM training_details");
while($rowalldura=mysql_fetch_array($alldura))
{
$Dura=$rowalldura['Duration'];
$sql="SELECT * FROM training_details WHERE Duration='".$Dura."' AND Training_Id='".$train_id."' AND Teacher_NIC in($All_Teachers)";
$tot_tea=mysql_query($sql);
if($tot_tea)
{
if(mysql_num_rows($tot_tea)>0)
{
$nothing="false";
echo '<option value="'.$Dura.'">'.$Dura.'</option>';
if(empty($first_option))
{
$first_option=$Dura;
}
}
}
}
if($nothing!="false")
{
echo '<option value="">No result</option>';
}
$tot_f_tea=mysql_query("SELECT * FROM teacher WHERE (Gender='Female' OR Gender='female') AND School_Id='$School_Id'");
if($tot_f_tea)
{
while($row_fe_tea=mysql_fetch_array($tot_f_tea))
{
if(empty($Female_Teachers))
{
$Female_Teachers='"'.$row_fe_tea['T_NIC_Number'].'"';
}
else
{
$Female_Teachers=$Female_Teachers.',"'.$row_fe_tea['T_NIC_Number'].'"';
}
}
}
$tot_m_tea=mysql_query("SELECT * FROM teacher WHERE (Gender='Male' OR Gender='male') AND School_Id='$School_Id'");
if($tot_m_tea)
{
while($row_ma_tea=mysql_fetch_array($tot_m_tea))
{
if(empty($Male_Teachers))
{
$Male_Teachers='"'.$row_ma_tea['T_NIC_Number'].'"';
}
else
{
$Male_Teachers=$Male_Teachers.',"'.$row_ma_tea['T_NIC_Number'].'"';
}
}
}
if($first_option!="")
{
$fir_val_male=mysql_query("SELECT COUNT(DISTINCT(Teacher_NIC)) AS males FROM training_details WHERE Duration='".$first_option."' AND Training_Id='".$train_id."' AND Teacher_NIC in($Male_Teachers)");
if($fir_val_male)
{
if($row_fir_mval=mysql_fetch_array($fir_val_male))
{
$Tra_Male_Teachers=$row_fir_mval['males'];
}
}

$fir_val_female=mysql_query("SELECT COUNT(DISTINCT(Teacher_NIC)) AS females FROM training_details WHERE Duration='".$first_option."' AND Training_Id='".$train_id."' AND Teacher_NIC in($Female_Teachers)");
if($fir_val_female)
{
if($row_fir_fval=mysql_fetch_array($fir_val_female))
{
$Tra_Female_Teachers=$row_fir_fval['females'];
}
}
}
echo '</select></form><label><b> :</b></label><div id="byduration"><table height="105" class="imgholder1">  
              <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
         <tr>
        <th> </th>
         <td></td>
         </tr>
		 <tr>
		 <th><label>Number of male teachers:</label>
         </th>
         <td>';
		 if($Tra_Male_Teachers=="")
		 {
		 $Tra_Male_Teachers="0";
		 }
		 if($Tra_Female_Teachers=="")
		 {
		 $Tra_Female_Teachers="0";
		 }
if($Tra_Male_Teachers!="0")
{
echo "<input type='text' name='Tra_Male_Teachers' value='$Tra_Male_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Tra_Male_Teachers' value='$Tra_Male_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>   
       <tr>
        <th>        
         <label>Number of female teachers:</label>
         </th>
         <td>';
if($Tra_Female_Teachers!="0")
{
echo "<input type='text' name='Tra_Female_Teachers' value='$Tra_Female_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Tra_Female_Teachers' value='$Tra_Female_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td></tr> 
           </table></div></div>
</div>
 </li>
        <li><div id="get_popup"></div>
          <h6 align="center">Curriculum details</h6>';
		  $procheck=mysql_query("SELECT * FROM programmes WHERE School_Id='$School_Id'");
		  if($procheck)
		  {
		  if(mysql_num_rows($procheck)==0)
		  {
		  echo '<font color="red">*There is no programme details for this school</font><br/><br/>';
		  }
		  }
           echo '<form name="pro_name"><label><b>Programme Name:</b></label>';
		   echo "<select name='Programme_Name' id='$School_Id' onChange='getyear(this.value,this.id)' onmouseover='clearpopbox()'>";
	  $pro=mysql_query("SELECT DISTINCT(Programme_Id) FROM programmes WHERE School_Id='$School_Id'");
 while($row=mysql_fetch_array($pro))
  {
  if(empty($First_ProgrammeId))
  {
  $First_ProgrammeId=$row['Programme_Id'];
  }
	 $Pro_Id=$row['Programme_Id'];
	  $resultp=mysql_query("SELECT * FROM programme WHERE Programme_Id='$Pro_Id'");
  if($rowp=mysql_fetch_array($resultp))
  {
		$pro_name=$rowp['Programme_Name'];
}
echo '<option value="'.$pro_name.'">'.$pro_name.'</option>';
  }
  if(empty($First_ProgrammeId))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select></form>
<div id="year">
<label><b>Year:</b></label>';
       echo "<select name='Programme_Year' id='$School_Id' onChange='getdetails(this.value,this.id)' onmouseover='clearpopbox()'>";
	  $proyear=mysql_query("SELECT DISTINCT(Year) FROM programmes WHERE Programme_Id='$First_ProgrammeId' AND School_Id='$School_Id'");
 while($rowyear=mysql_fetch_array($proyear))
  {
   if(empty($First_ProgrammeYear))
  {
  $First_ProgrammeYear=$rowyear['Year'];
  }
	 $Year=$rowyear['Year'];
	 echo '<option value="'.$Year.'">'.$Year.'</option>';
  }
   if(empty($First_ProgrammeYear))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select>';
$prog=mysql_query("SELECT * FROM programmes WHERE Programme_Id='$First_ProgrammeId' AND Year='$First_ProgrammeYear' AND School_Id='$School_Id'");
if($prog)
{
if($row_prog=mysql_fetch_array($prog))
{
$Pro_Male_Students=$row_prog['No_Of_Male_Students'];
$Availability_Tea_Guides=$row_prog['Availability_Tguides'];
$Availability_Books=$row_prog['Availability_Books'];
$Required_Teachers=$row_prog['Required_Teachers'];
$Trained_Teachers=$row_prog['Trained_Teachers'];
$Teachers_In_Training=$row_prog['Teachers_In_Training'];
$Pro_Female_Students=$row_prog['No_Of_Female_Students'];
}
else
{
$Pro_Male_Students='0';
$Availability_Tea_Guides='_';
$Availability_Books='_';
$Required_Teachers='0';
$Trained_Teachers='0';
$Teachers_In_Training='0';
$Pro_Female_Students='0';
}
}
    echo '<br/>
	  <div id="prodetails">
      <table height="200" class="imgholder">
       <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
      <tr>
        <th>        
         <label>Number of male students:</label>
         </th>
         <td>';
         echo "<input type='text' name='Pro_Male_Students' value='$Pro_Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Number of female students:</label>
         </th>
         <td>';
        echo "<input type='text' name='Pro_Female_Students' value='$Pro_Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Number of teachers in training:</label>
         </th>
         <td>';
/*
if($Teachers_In_Training!="0")
{
echo "<input type='text' name='Teachers_In_Training' value='$Teachers_In_Training' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Teachers_In_Training' value='$Teachers_In_Training' readonly='readonly' onmouseover='clearpopbox()'/>";
}
*/
echo "<input type='text' name='Teachers_In_Training' value='$Teachers_In_Training' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Number of trained teachers:</label>
         </th>
         <td>';
		 /*
if($Trained_Teachers!="0")
{
echo "<input type='text' name='Trained_Teachers' value='$Trained_Teachers' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Trained_Teachers' value='$Trained_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
}
*/
echo "<input type='text' name='Trained_Teachers' value='$Trained_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Required teachers:</label>
         </th>
         <td>';
        echo "<input type='text' name='Required_Teachers' value='$Required_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Availability of books:</label>
         </th>
         <td>';
        echo "<input type='text' name='Availability_Books' value='$Availability_Books' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Availability of teachers guides:</label>
         </th>
         <td>';
        echo "<input type='text' name='Availability_Tea_Guides' value='$Availability_Tea_Guides' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         </table></div></div>';
echo '<br/><h6 align="center">';
echo "Students' details</h6>";
$stucheck=mysql_query("SELECT * FROM students WHERE School_Id='$School_Id'");
		  if($stucheck)
		  {
		  if(mysql_num_rows($stucheck)==0)
		  {
		  echo "<font color='red'>*There is no student's details for this school</font><br/><br/>";
		  }
		  }
        echo "<label>Search by</label>
		   <br/> <br/><form name='Stu_Grade'>
		  <label><b>grade</b></label>";
echo "<select name='Grade' id='$School_Id' onChange='grade(this.value,this.id)' onmouseover='clearpopbox()'>";
	 	 $grade=mysql_query("SELECT DISTINCT(Grade) FROM students WHERE School_Id='$School_Id'");
 while($rowgrade=mysql_fetch_array($grade))
  {
  if(empty($First_Grade))  
  {
  $First_Grade=$rowgrade['Grade'];
  }
	 $Grade=$rowgrade['Grade'];
	 echo '<option value="'.$Grade.'">'.$Grade.'</option>';
  }
   if(empty($First_Grade))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select></form><br/><div id="Stu_Details">
<form name="Stu_Year"><label><b>Year:</b></label>';
       echo "<select name='Student_Year' id='$School_Id' onChange='stu_getyear(this.value,this.id)' onmouseover='clearpopbox()'>";
	  $proyear=mysql_query("SELECT DISTINCT(Year) FROM programmes WHERE Grade='$First_Grade' AND School_Id='$School_Id'");
 while($rowyear=mysql_fetch_array($proyear))
  {
   if(empty($First_Year))  
  {
  $First_Year=$rowyear['Year'];
  }
	 $Year=$rowyear['Year'];
	 echo '<option value="'.$Year.'">'.$Year.'</option>';
  }
   if(empty($First_Year))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select>
		 </form>
<div id="stu_year">';
$stud=mysql_query("SELECT * FROM students WHERE Grade='$First_Grade' AND School_Id='$School_Id' AND Year='$First_Year'");
if($stud)
{
if($row_stud=mysql_fetch_array($stud))
{
$Gra_Male_Students=$row_stud['No_of_Male'];
$Gra_Female_Students=$row_stud['No_of_Female'];
}
else
{
$Gra_Male_Students='0';
$Gra_Female_Students='0';
}
}
echo ' <table height="80" class="imgholder">
           <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
      <tr>
        <th>        
         <label>Total number of male students:</label>
         </th>
         <td>';
         echo "<input type='text' name='Gra_Male_Students' value='$Gra_Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Total number of female students:</label>
         </th>
         <td>';
         echo "<input type='text' name='Gra_Female_Students' value='$Gra_Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
         <tr>
        <td> </td>
         <td>
		  </td>
         </tr></table>
		 <label><b>Programme:</b></label>';
         echo "<select name='Student_Programme_Name' id='$School_Id' onChange='get_stu_details(this.value,this.id)' onmouseover='clearpopbox()'>";
	  $pro=mysql_query("SELECT DISTINCT(Programme_Id) FROM programmes WHERE School_Id='$School_Id' AND Year='$First_Year'");
 while($row=mysql_fetch_array($pro))
  {
  if(empty($First_Pro_Id))
  {
  $First_Pro_Id=$row['Programme_Id'];
  }
	 $Pro_Id=$row['Programme_Id'];
	  $resultp=mysql_query("SELECT * FROM programme WHERE Programme_Id='$Pro_Id'");
  if($rowp=mysql_fetch_array($resultp))
  {
		$pro_name=$rowp['Programme_Name'];
}
echo '<option value="'.$pro_name.'">'.$pro_name.'</option>';
  }
  if(empty($First_Pro_Id))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select>
<div id="stu_year_details">';
$progr=mysql_query("SELECT * FROM programmes WHERE Year='$First_Year' AND Programme_Id='$First_Pro_Id' AND School_Id='$School_Id' AND Grade='$First_Grade'");
if($progr)
{
if($row_progr=mysql_fetch_array($progr))
{
$Pro_Gra_Male_Students=$row_progr['No_Of_Male_Students'];
$Pro_Gra_Female_Students=$row_progr['No_Of_Female_Students'];
}
else
{
$Pro_Gra_Male_Students='0';
$Pro_Gra_Female_Students='0';
}
}
 echo '<table height="100" class="imgholder">
          <tr>
        <td> </td>
         <td></td>
         </tr>
         <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
          <tr>
        <th>        
         <label>Number of male students:</label>
         </th>
         <td>';
        echo "<input type='text' name='Pro_Gra_Male_Students' value='$Pro_Gra_Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Number of female students:</label>
         </th>
         <td>';
        echo "<input type='text' name='Pro_Gra_Female_Students' value='$Pro_Gra_Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         </table></div></div></div><br/>
         <h6 align="center">Exam details</h6>';
		 $exacheck=mysql_query("SELECT * FROM exam WHERE School_Id='$School_Id'");
		  if($exacheck)
		  {
		  if(mysql_num_rows($exacheck)==0)
		  {
		  echo "<font color='red'>*There is no exam details for this school</font><br/><br/>";
		  }
		  }
		 echo '<form name="ExaName"><label><b>Exam Name:</b></label>';
         echo "<select name='Exam_Name' id='$School_Id' onChange='getexamsubject(this.value,this.id)' onmouseover='clearpopbox()'>";
	  $exa=mysql_query("SELECT DISTINCT(Exam_Name) FROM exam WHERE School_Id='$School_Id'");
 while($row=mysql_fetch_array($exa))
  {
  if(empty($First_Exam))
  {
  $First_Exam=$row['Exam_Name'];
  }
	 $exa_name=$row['Exam_Name'];
echo '<option value="'.$exa_name.'">'.$exa_name.'</option>';
  }
  if(empty($First_Exam))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select></form>
<div id="subject">';
echo '<form name="Subject_name"><label><b>Subject:</b></label>';
		   echo "<select name='Subject' id='$School_Id' onChange='getexamyear(this.value,this.id)' onmouseover='clearpopbox()'>";
	  $pros=mysql_query("SELECT DISTINCT(Subject) FROM exam WHERE Exam_Name='$First_Exam' AND School_Id='$School_Id'");
 while($rows=mysql_fetch_array($pros))
  {
  if(empty($First_Subject))
  {
  $First_Subject=$rows['Subject'];
  }
		$Subject_name=$rows['Subject'];
echo '<option value="'.$Subject_name.'">'.$Subject_name.'</option>';
  }
  if(empty($First_Subject))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select></form>
<div id="exa_year">		 
           <label><b>Year:</b></label>';
            echo "<select name='Exam' id='$School_Id' onChange='get_exam_details(this.value,this.id)' onmouseover='clearpopbox()'>";
	 	 $ExamYear=mysql_query("SELECT DISTINCT(Year) FROM exam WHERE Exam_Name='$First_Exam' AND Subject='$First_Subject' AND School_Id='$School_Id'");
 while($rowexam=mysql_fetch_array($ExamYear))
  {
  if(empty($First_Exam_Year))
  {
  $First_Exam_Year=$rowexam['Year'];
  }
	 $Year=$rowexam['Year'];
	 echo '<option value="'.$Year.'">'.$Year.'</option>';
  }
  if(empty($First_Exam_Year))
  {
 echo '<option value="No result">No result</option>';
  }
echo '</select><div id="Exam">';
$exam=mysql_query("SELECT * FROM exam WHERE Exam_Name='$First_Exam' AND Year='$First_Exam_Year' AND Subject='$First_Subject' AND School_Id='$School_Id'");
if($exam)
{
if($row_exam=mysql_fetch_array($exam))
{
$Sat_Students=$row_exam['No_Of_Sat_Students'];
$Passed_Students=$row_exam['No_Of_Passed_Students'];
$Percentage=($Passed_Students/$Sat_Students)*100;
if($Percentage!="")
{
$Percentage=$Percentage."%";
}
}
else
{
$Sat_Students="0";
$Passed_Students="0";
$Percentage="0%";
}
}
  echo '<table height="100" class="imgholder">
             <tr>
        <th>        
         <label>Total number sat students:</label>
         </th>
         <td>';
         echo "<input type='text' name='Sat_Students' value='$Sat_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         <tr>
        <th>        
         <label>Total number of passed students:</label>
         </th>
         <td>';
         echo "<input type='text' name='Passed_Students' value='$Passed_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
          <tr>
        <th>        
         <label>Percentage:</label>
         </th>
         <td>';
         echo "<input type='text' name='Percentage' value='$Percentage' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr>
         </table></div></div></div></li>
        <li class="last">
        <h6 align="center">Lab details</h6>';
		if($Tot_Labs=="0")
{
echo '<font color="red">*There are no labs for this school</font><br/>';
}
        echo '<table class="imgholder">
        <tr>
        <th width="49%">
		<label>Total number of labs:</label>
		</th>
         <td width="51%">';
if($Tot_Labs!="0")
{
echo "<input type='text' name='Total_Labs' value='$Tot_Labs' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Total_Labs' value='$Tot_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>
		 <tr>
        <th>
         <label>Date of commencement of last lab:</label>
		 </th>
         <td>';
		 if($Last_Comm_Date=="")
			{
			$Last_Comm_Date='_';
			}
         echo "<input type='text' name='Last_Comm_Date' value='$Last_Comm_Date' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
         </tr></table><br/>
		          <label>Search by lab type</label>
		  <br/><br/>
          <label><b>Lab type:</b></label>';	  
        echo "<form name='l_t'><select name='Lab_Type' id='$School_Id' onChange='lab_type(this.value,this.id)' onmouseover='clearpopbox()'>";
	 	 $labtype=mysql_query("SELECT DISTINCT(Lab_Type) FROM lab WHERE School_Id='$School_Id'");
 while($rowlabtype=mysql_fetch_array($labtype))
  {
  if(empty($First_Lab_Type))
  {
  $First_Lab_Type=$rowlabtype['Lab_Type'];
  }
	 $Lab_Type=$rowlabtype['Lab_Type'];
	 echo '<option value="'.$Lab_Type.'">'.$Lab_Type.'</option>';
  }
  if(empty($First_Lab_Type))
  {
  echo '<option value="No result">No result</option>';
  }
echo '</select></form><div id="lab_details">';
$lab1=mysql_query("SELECT * FROM lab WHERE Lab_Type='$First_Lab_Type' AND School_Id='$School_Id'");
if($lab1)
{
while($row_lab=mysql_fetch_array($lab1))
{
if(empty($A_Labs))
{
$A_Labs='"'.$row_lab['Lab_Id'].'"';
}
else
{
$A_Labs=$A_Labs.',"'.$row_lab['Lab_Id'].'"';
}
}
}

$lab_net=mysql_query("SELECT DISTINCT(LAN_Supplier) FROM network WHERE School_Id='$School_Id' AND Lab_Id in($A_Labs)");
if($lab_net)
{
while($row_lab_net=mysql_fetch_array($lab_net))
{
if($row_lab_net['LAN_Supplier']!="")
{
if(empty($lan_Suppliers))
{
$lan_Suppliers=$row_lab_net['LAN_Supplier'];
}
else
{
$lan_Suppliers=$lan_Suppliers.','.$row_lab_net['LAN_Supplier'];
}
}
}
}
$lab_res=mysql_query("SELECT * FROM resource_details WHERE School_Id='$School_Id' AND Lab_Id in($A_Labs)");
if($lab_res)
{
while($row_lab_res=mysql_fetch_array($lab_res))
{
if($row_lab_res['Name_Of_Supplier']!="")
{
if(empty($res_Suppliers))
{
$res_Suppliers=$row_lab_res['Name_Of_Supplier']."_".$row_lab_res['Resource_Id'];
}
else
{
$res_Suppliers=$res_Suppliers.','.$row_lab_res['Name_Of_Supplier']."_".$row_lab_res['Resource_Id'];
}
}
}
}
$lab2=mysql_query("SELECT COUNT(Lab_Id) AS T_Labs FROM network WHERE Availability_Of_LAN='Yes' AND School_Id='$School_Id' AND Lab_Id in($A_Labs)");
if($lab2)
{
if($row_lab2=mysql_fetch_array($lab2))
{
$Lan_Ava_Labs=$row_lab2['T_Labs'];
}
}
$lab3=mysql_query("SELECT COUNT(Lab_Id) AS T_Labs FROM network WHERE WAN_Connection_Type!='' AND School_Id='$School_Id' AND Lab_Id in($A_Labs)");
if($lab3)
{
if($row_lab=mysql_fetch_array($lab3))
{
$Wan_Ava_Labs=$row_lab['T_Labs'];
}
}
if($Lan_Ava_Labs=="")
{
$Lan_Ava_Labs="0";
}
if($Wan_Ava_Labs=="")
{
$Wan_Ava_Labs="0";
}
echo '<table class="imgholder">
<tr>
        <th>
		 <label>Number of lan available labs:</label> 
</th>
         <td>';	
if($Lan_Ava_Labs!="0")
{
echo "<input type='text' name='Lan_Ava_Labs' value='$Lan_Ava_Labs' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{         
echo "<input type='text' name='Lan_Ava_Labs' value='$Lan_Ava_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>
		 <tr>
        <th>
		 <label>Number of wan available labs:</label>
		 </th>
         <td>';
 if($Wan_Ava_Labs!="0")
{
echo "<input type='text' name='Wan_Ava_Labs' value='$Wan_Ava_Labs' readonly='readonly' id='$Id' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Wan_Ava_Labs' value='$Wan_Ava_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
         </tr>
		  <tr>
        <th></th>
         <td></td>
         </tr>
		 <tr>
        <th height="87" colspan="2">';
$all_lan_suppliers=explode(",",$lan_Suppliers);
if(count($all_lan_suppliers)>4)
{
echo '<div style="height:180px;overflow-Y:scroll;">';
}
echo '<table height="68">';
echo '<tr>
            <th>        
              <label>Lan supplier</label>
              </th>
            <th>        
              <label>Number of labs</label>
              </th>
            </tr>';
for($ls=0;$ls<count($all_lan_suppliers);$ls++)
{
$Supplier=$all_lan_suppliers[$ls];
$lab4=mysql_query("SELECT COUNT(Lab_Id) AS T_Labs FROM network WHERE LAN_Supplier='$Supplier' AND School_Id='$School_Id' AND Lab_Id in($A_Labs)");
if($lab4)
{
if($row_lab=mysql_fetch_array($lab4))
{
$Number_Of_Labs=$row_lab['T_Labs'];
}
else
{
$Number_Of_Labs='0';
}
}
   echo '<tr>
            <td height="20">';
			if($Supplier=="")
			{
			$Supplier="_";
			}
			if($Number_Of_Labs=="")
			{
			$Number_Of_Labs='0';
			}
         echo "<input type='text' name='Supplier' value='$Supplier' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
            <td>';
if($Number_Of_Labs!="0")
{
echo "<input type='text' name='Number_Of_Labs' value='$Number_Of_Labs' readonly='readonly' id='$Id,$ls' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Number_Of_Labs' value='$Number_Of_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";
}
echo '</td>
            </tr>';
		  }
          echo '</table>';
if(count($all_lan_suppliers)>4)
{
echo '</div>';
}
        echo '</th>
         </tr>
		   </table>
		   <br/>
          <div style="width:410px; height:300px; overflow-X:scroll; overflow-Y:scroll;">
           <label>Resource supplyers details</label><br/>';
$all_res_suppliers=explode(",",$res_Suppliers);
for ($i = 0; $i <count($all_res_suppliers); $i++) {
 $temp =$all_res_suppliers[$i];
  if($temp!="")
  {
  if(empty($final_res_Suppliers))
  {
 $final_res_Suppliers=$temp;
 }
 else
 {
 $final_res_Suppliers=$final_res_Suppliers.",".$temp;
 }
  }
  $j = $i;
  for ($k = 0; $k <count($all_res_suppliers); $k++) 
  {
    if ($k != $j) {
      if ($temp == $all_res_suppliers[$k]) 
	  {
        $all_res_suppliers[$k]="";
      }
    }
  }
}
echo '<table><tr>
			   <th>        
			     <label>Organization</label>
			     </th>
			   <th>        
			     <label>Resource Type</label>
			     </th>
			   <th>        
			     <label>Number of equipments</label>
			     </th>
			   </tr>';
$exp_final_res_Suppliers=explode(",",$final_res_Suppliers);
for($rs=0;$rs<count($exp_final_res_Suppliers);$rs++)
{
$Supplier_Resource=explode("_",$exp_final_res_Suppliers[$rs]);
$Organization=$Supplier_Resource[0];
$Res_Id=$Supplier_Resource[1];
$res_type=mysql_query("SELECT * FROM resource WHERE Resource_Id='$Res_Id'");
if($row_res_type=mysql_fetch_array($res_type))
{
$Resource_Type=$row_res_type['Resource_Type'];
}
$lab5=mysql_query("SELECT COUNT(Lab_Id) AS T_Labs FROM resource_details WHERE Name_Of_Supplier='$Organization' AND Resource_Id='$Res_Id' AND School_Id='$School_Id' AND Lab_Id in($A_Labs)");
if($lab5)
{
if($row_lab=mysql_fetch_array($lab5))
{
$Number_Of_Equipments=$row_lab['T_Labs'];
}
else
{
$Number_Of_Equipments='0';
}
}
if($Organization=="")
{
$Organization="_";
}
if($Resource_Type=="")
{
$Resource_Type="_";
}
		echo '<tr>
			     <td>';
         echo "<input type='text' name='Organization' value='$Organization' size='30' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
			     <td>';
         echo "<input type='text' name='Resource_Type' value='$Resource_Type' size='25' readonly='readonly' onmouseover='clearpopbox()'/>";
echo '</td>
			     <td>';
if($Number_Of_Equipments!="0")
{
echo "<input type='text' size='7' name='Number_Of_Equipments' value='$Number_Of_Equipments' readonly='readonly' id='$Id,$rs,$final_res_Suppliers' onmouseover='getdetails_popup(this.name,this.id)'/>";
}
else
{
echo "<input type='text' name='Number_Of_Equipments' value='$Number_Of_Equipments' size='7' readonly='readonly' onmouseover='clearpopbox()'/>";
}
		 echo '</td>
			     </tr>';
				 }
 echo '</table> </div></div>
			          </li>
      </ul>
      <br class="clear" />
    </div>      
    <div class="clear"></div>
  </div>
</div>';
}
else
{
?>
<div class="wrapper col2">
  <div id="intro">   
    <div class="fl_right">
     <h1>School's details&hellip;</h1>
       <ul>     
        <li> 
        <table height="141">
        <tr>
        <td width="120">        
         <label>School Name:</label>
         </td>
         <td width="172">
         <?php
         echo "<input type='text' size='30' name='Name' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>School Id:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='School_Id' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Census Number:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Census_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Address:</label>
         </td>
         <td>
      	<textarea name='Address' readonly='readonly' onmouseover='clearpopbox()'><?php echo $Address." "; ?></textarea>
          </td>
         </tr>
          <tr>
        <td>        
         <label>Principal Name:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Principal_Name' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
         </table>
        </li>
        <li>
               <table height="141">
        <tr>
        <td width="120">        
         <label>Province:</label>
         </td>
         <td width="170">
         <?php
         echo "<input type='text' name='Province' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>District:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='District' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Zone:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Zone' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Division</label>
         <label>:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Division' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>School Status:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Status' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
		 <tr>
        <td width="189">        
         <label>School Type:</label>
         </td>
         <td width="111">
         <?php
         echo "<input type='text' name='Type' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
         </table>
        </li>
        <li>
          <table height="141">        
          <tr>
        <td>        
         <label>Medium:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Medium' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Grade Range:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Grade_Range' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Number of Male Students:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Number of Female Students:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
		 <tr>
        <td>        
         <label>Total Number of Teachers:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Tot_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
		  <tr>
        <td>        
         <label>Total Number of Labs:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Tot_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
         </table>
        </li>
        <li class="last">
          <table height="141">
        <tr>
        <td width="119">        
         <label>Telephone Number:</label>
         </td>
         <td width="170">
         <?php
         echo "<input type='text' name='Tp_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Fax Number:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Fax_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Email Address:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='E_Mail' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Web Address:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Web_Address' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
          <tr>
        <td>        
         <label>Account Number:</label>
         </td>
         <td>
         <?php
         echo "<input type='text' name='Account_Number' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
           <tr>
        <td>        
         <label>Special Projects:</label>
         </td>
         <td>
         <textarea name='Special_Projects_Others' readonly='readonly' onmouseover='clearpopbox()'><?php echo $sp." "; ?></textarea>
         </td>
         </tr>
         </table>
        </li>
      </ul> 
    </div>
    </div>
 <div class="clear"></div>
</div>

<div class="wrapper col3">
  <div id="container">
    <div id="latest">
      <ul>
        <li class="first">
          <h6 align="center">Staff details</h6>
                  <label><b>In charge's name:</b></label>
          <?php
         echo "<input type='text' name='Name' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         <br/>
         <br/>
          <select name="Staff_Type" id="" onChange="getSts_Det(this.value,this.id)">
        <?php
	   echo '<option value="Academic staff">Academic staff</option>';
	    echo '<option value="Non academic staff">Non academic staff</option>';
 ?>
      </select>
        <br/><div id="staff">
    <table height="175" class="imgholder"> 
      <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
      <tr>
        <th>        
         <label>Number of male teachers:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Male_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>   
       <tr>
        <th>        
         <label>Number of female teachers:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Female_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>         
         <tr>
        <th>        
         <label>Number of resource persons:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Res_Persons' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Number of graduate teachers:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Graduate_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Number of </label><select name='Appo_Sub' id='' onChange='showAppTea(this.value,this.id)'>
         <?php
        	  echo '<option value="Select One">Select One</option>';
	  $app_s=mysql_query("SELECT DISTINCT(Appointed_Subject) FROM teacher");
 while($rowapp_s=mysql_fetch_array($app_s))
  {
	 $Appointed_Subject=$rowapp_s['Appointed_Subject'];
	echo '<option value="'.$Appointed_Subject.'">'.$Appointed_Subject.'</option>';
  }
         ?>
         </select><label> Teachers:</label>
         </th>
         <td>
         <?php
         echo "<div id='Appo_Tea'><input type='text' name='No_Appo_Teachers' readonly='readonly' onmouseover='clearpopbox()'/></div>";
         ?>
         </td>
         </tr>
  </table></div><br/>
    <h6 align="center">Trained staffs' details</h6><form name="traform">
    <label><b>Training name:</b></label><select name="Tra_name" id="" onChange="TraDetails(this.value,this.id)">
         <?php
        	  echo '<option value="Select One">Select One</option>';
	  $tra_nam=mysql_query("SELECT DISTINCT(Training_Name) FROM training");
 while($rowtra_nam=mysql_fetch_array($tra_nam))
  {
	 $Training_Name=$rowtra_nam['Training_Name'];
	echo '<option value="'.$Training_Name.'">'.$Training_Name.'</option>';
  }
         ?></select>
         <br/><br/><div id='TraDet'><label><b>Total number of trained teachers:</b></label>
         <?php
         echo "<input type='text' name='Tra_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
      <br/><br/><label><b>Total number of resource persons:</b></label>
         <?php
         echo "<input type='text' name='Resource_Persons' readonly='readonly' onmouseover='clearpopbox()'/></div>";
         ?>
          <br/><br/>      
         <label><b>Duration </b></label>
         <select name="func" id="" onChange="getDurati(this.value,this.id)">
         <?php
        	  echo '<option value="Select One">Select One</option>';
	 	echo '<option value="=">Equal to</option>';
		echo '<option value=">">Greater than</option>';
		echo '<option value=">=">Greater than or equal to</option>';
	echo '<option value="<">Less than</option>';
		echo '<option value="<=">Less than or equal to</option>';
          ?>
         </select>
         <label> </label>
		 <div id='Durati'>
         <select name="Duration" id="" onChange="duration(this.value,this.id)">
         <?php
        	  echo '<option value="Select One">Select One</option>';
	  $dur=mysql_query("SELECT DISTINCT(Duration) FROM training_details WHERE Teacher_NIC in($All_Teachers)");
 while($rowdur=mysql_fetch_array($dur))
  {
	 $Duration=$rowdur['Duration'];
	echo '<option value="'.$Duration.'">'.$Duration.'</option>';
  }
         ?>
         </select></form><label><b> :</b></label>
         <table height="105" class="imgholder1">  
              <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
         <tr>
        <th>
         </th><td>
         </td>
         </tr>
          <tr>
        <th>        
         <label>Number of male teachers:</label>
         </th>
         <td>
         <?php
         echo "<div id='byduration'><input type='text' name='Tra_Male_Teachers' readonly='readonly' onmouseover='clearpopbox()' value='$Tra_Male_Teachers'/>";
         ?>
         </td>
         </tr>   
       <tr>
        <th>        
         <label>Number of female teachers:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Tra_Female_Teachers' value='$Tra_Female_Teachers' readonly='readonly' onmouseover='clearpopbox()'/></div></div>";
         ?>
         </td>
         </tr> 
  </table> 
 </li>
        <li><div id="get_popup"></div>
          <h6 align="center">Curriculum details</h6>
           <form name="pro_name"><label><b>Programme Name:</b></label> <select name="Programme_Name" id="" onChange="getyear(this.value,this.id)">
        <?php
	  echo '<option value="Select One">Select One</option>';
	  $pro=mysql_query("SELECT DISTINCT(Programme_Id) FROM programme");
 while($row=mysql_fetch_array($pro))
  {
	 $Pro_Id=$row['Programme_Id'];
	  $resultp=mysql_query("SELECT * FROM programme WHERE Programme_Id='$Pro_Id'");
  if($rowp=mysql_fetch_array($resultp))
  {
		$pro_name=$rowp['Programme_Name'];
}
echo '<option value="'.$pro_name.'">'.$pro_name.'</option>';
  }
	       
 ?>
      </select></form>

<div id="year"><label><b>Year:</b></label>
      <select name="Programme_Year" id="Programme_Year" onChange="getdetails(this.value)">
        <?php
	  echo '<option value="Select One">Select One</option>';
	  $proyear=mysql_query("SELECT DISTINCT(Year) FROM programmes");
 while($rowyear=mysql_fetch_array($proyear))
  {
	 $Year=$rowyear['Year'];
	 echo '<option value="'.$Year.'">'.$Year.'</option>';
  }
	       
 ?>
      </select>
      <br/><div id="prodetails">
      <table height="200" class="imgholder">
       <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
      <tr>
        <th>        
         <label>Number of male students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Pro_Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Number of female students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Pro_Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Number of teachers in training:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Teachers_In_Training' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Number of trained teachers:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Trained_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Required teachers:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Required_Teachers' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Availability of books:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Availability_Books' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Availability of teachers guides:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Availability_Tea_Guides' readonly='readonly' onmouseover='clearpopbox()'/>";
		 ?>
         </td>
         </tr>
         </table></div></div>
          <h6 align="center">Students' details</h6>
           <label>Search by</label>
		   <br/>
		    <br/>
		  <form name='Stu_Grade'><label><b>grade</b></label>
            <select name="Grade" id="" onChange="grade(this.value,this.id)">
         <?php
        echo '<option value="Select One">Select One</option>';
	 	 $grade=mysql_query("SELECT DISTINCT(Grade) FROM students");
 while($rowgrade=mysql_fetch_array($grade))
  {
	 $Grade=$rowgrade['Grade'];
	 echo '<option value="'.$Grade.'">'.$Grade.'</option>';
  }
          ?>
         </select></form><div id="Stu_Details">
		 <form name="Stu_Year">		
<label><b>Year:</b></label>
<select name='Student_Year' id='' onChange='stu_getyear(this.value,this.id)'>
<option value="Select One">Select One</option>
<?php
	  $proyear=mysql_query("SELECT DISTINCT(Year) FROM programmes");
 while($rowyear=mysql_fetch_array($proyear))
  {
	 $Year=$rowyear['Year'];
	 ?>
	<option value="'.$Year.'"><?php echo $Year; ?></option>
	<?php
  }
?>
</select></form>
 <div id="stu_year">
          <table height="80" class="imgholder">
           <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
      <tr>
        <th>        
         <label>Total number of male students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Gra_Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Total number of female students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Gra_Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
         <tr>
        <td>
         </td>
         <td></td>
         </tr></table>
         <label><b>Programme:</b></label><select name="Student_Programme_Name" id="" onChange='get_stu_details(this.value,this.id)'>
        <?php
	  echo '<option value="Select One" id="" onChange="stu_getyear(this.value,this.id)">Select One</option>';
	  $pro=mysql_query("SELECT DISTINCT(Programme_Id) FROM programme");
 while($row=mysql_fetch_array($pro))
  {
	 $Pro_Id=$row['Programme_Id'];
	  $resultp=mysql_query("SELECT * FROM programme WHERE Programme_Id='$Pro_Id'");
  if($rowp=mysql_fetch_array($resultp))
  {
		$pro_name=$rowp['Programme_Name'];
}
echo '<option value="'.$pro_name.'">'.$pro_name.'</option>';
  }
	       
 ?>
      </select>
	  <div id="stu_year_details"><table height="100" class="imgholder">
          <tr>
        <td> </td>
         <td>
          </td>
         </tr>
         <tr>
        <th>        
        </th>
         <td>
        </td>
         </tr> 
          <tr>
        <th>        
         <label>Number of male students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Gra_Male_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Number of female students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Gra_Female_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         </table></div></div><br/>
         <h6 align="center">Exam details</h6>
		  <form name="ExaName"><label><b>Exam Name:</b></label>
<select name='Exam_Name' id='$School_Id' onChange='getexamyear(this.value,this.id)'>
<option value="Select One">Select One</option>
<?php 
$exa=mysql_query("SELECT DISTINCT(Exam_Name) FROM exam");
 while($rowexa=mysql_fetch_array($exa))
  {
	 $exa_name=$rowexa['Exam_Name'];
echo '<option value="'.$exa_name.'">'.$exa_name.'</option>';
  }
  ?>
</select></form>
<div id="subject">
<?php
echo '<form name="Subject_name"><label><b>Subject:</b></label>';
		   echo "<select name='Subject' id='$School_Id' onChange='getyear(this.value,this.id)'>";
	  $pros=mysql_query("SELECT DISTINCT(Subject) FROM programmes");
 while($rows=mysql_fetch_array($pros))
  {
  	$Subject_name=$rows['Subject'];
echo '<option value="'.$Subject_name.'">'.$Subject_name.'</option>';
  }
  echo '</select></form>';
  ?>
<div id="exa_year">	
           <label><b>Year:</b></label>
            <select name="Exam" id="" onChange="get_exam_details(this.value,this.id)">
         <?php
        echo '<option value="Select One">Select One</option>';
 	 $ExamYear=mysql_query("SELECT DISTINCT(Year) FROM exam");
 while($rowexam=mysql_fetch_array($ExamYear))
  {
	 $Year=$rowexam['Year'];
	 echo '<option value="'.$Year.'">'.$Year.'</option>';
  }
          ?>
         </select><div id="Exam">
          <table height="100" class="imgholder">
             <tr>
        <th>        
         <label>Total number sat students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Sat_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         <tr>
        <th>        
         <label>Total number of passed students:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Passed_Students' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
          <tr>
        <th>        
         <label>Percentage:</label>
         </th>
         <td>
         <?php
         echo "<input type='text' name='Percentage' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
         </table></div></div></div></li>
        <li class="last">
        <h6 align="center">Lab details</h6>
        <table class="imgholder">
        <tr>
        <th width="49%">
		<label>Total number of labs:</label>
		</th>
         <td width="51%">
          <?php
         echo "<input type='text' name='Total_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?>
		  </td>
         </tr>
		 <tr>
        <th>
         <label>Date of commenctment of last lab:</label>
		 </th>
         <td>
         <?php
         echo "<input type='text' name='Last_Comm_Date' readonly='readonly' onmouseover='clearpopbox()'/>";
         ?> </td>
         </tr></table><br/>
		     <label>Search by lab type</label>
		  <br/><br/><label><b>Lab type:</b></label>
		 <form name='l_t'><select name="Lab_Type" id="" onChange="lab_type(this.value,this.id)">
         <?php
        echo '<option value="Select One">Select One</option>';
	 	 $labtype=mysql_query("SELECT DISTINCT(Lab_Type) FROM lab");
 while($rowlabtype=mysql_fetch_array($labtype))
  {
	 $Lab_Type=$rowlabtype['Lab_Type'];
	 echo '<option value="'.$Lab_Type.'">'.$Lab_Type.'</option>';
  }
          ?>
         </select></form><div id="lab_details">	
 <table class="imgholder"> 
			 <tr>
        <th>
		 <label>Number of lan available labs:</label> 
</th>
         <td>		 
         <?php
         echo "<input type='text' name='Lan_Ava_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>              
          </td>
         </tr>
		 <tr>
        <th>
		 <label>Number of wan available labs:</label>
		 </th>
         <td>
        <?php
		echo "<input type='text' name='Wan_Ava_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
         </td>
         </tr>
		  <tr>
        <th></th>
         <td></td>
         </tr>
		 <tr>
        <th height="87" colspan="2"><table height="68">
          <tr>
            <th>        
              <label>Supplier</label>
              </th>
            <th>        
              <label>Number of labs</label>
              </th>
            </tr>
          <tr>
            <td height="20">
              <?php
         echo "<input type='text' name='Supplier' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
              </td>
            <td>
              <?php
         echo "<input type='text' name='Number_Of_Labs' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
              </td>
            </tr>
          </table>
        </th>
         </tr>
		     </table>
           <div style="width:410px; height:300px; overflow-X:scroll; overflow-Y:scroll;">
           <table><tr>
			   <th>        
			     <label>Organization</label>
			     </th>
			   <th>        
			     <label>Resource Type</label>
			     </th>
			   <th>        
			     <label>Number of equipments</label>
			     </th>
			   </tr>
			   <tr>
			     <td>
			       <?php
         echo "<input type='text' name='Organization' size='30' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
			       </td>
			     <td>
			       <?php
         echo "<input type='text' name='Resource_Type' size='25' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
			       </td>
			     <td>
			       <?php
         echo "<input type='text' name='Number_Of_Equipments' size='7' readonly='readonly' onmouseover='clearpopbox()'/>";         ?>
			       </td>
			     </tr>
			   </table></div></div>
		    </li>
      </ul>
      <br class="clear" />
    </div>      
    <div class="clear"></div>
  </div>
  <?php
  }
  ?>
</div>
<div class="wrapper col5">
  <div id="copyright">
    <p class="fl_left">Schools Management System &copy; 2012 </p>
       <br class="clear"/>
  </div>
</div>
</body>
</html>
<?php
}
?>